-------------------------autotest_interface_BPM-----------------------
--【删除快照】
DROP DATABASE autotest_interface_BPM_KZ;
GO
PRINT 'autotest_interface_BPM【删除】删除快照完成'

--自动化库创建数据库快照   逻辑名
CREATE DATABASE autotest_interface_BPM_KZ ON (NAME = N'autotest_interface_BPM',
FILENAME=N'D:\自动化测试数据库\流程平台\接口自动化库\kz\autotest_interface_BPM_KZ.mdf') AS SNAPSHOT OF autotest_interface_BPM;
PRINT 'autotest_interface_BPM【创建】创建快照完成'

-------------------------autotest_interface_BPM_ERP35-----------------------
--【删除快照】
DROP DATABASE autotest_interface_BPM_ERP35_KZ;
GO
PRINT 'autotest_interface_BPM_ERP35【删除】删除快照完成'

--自动化库创建数据库快照   逻辑名
CREATE DATABASE autotest_interface_BPM_ERP35_KZ ON (NAME = N'dotnet_erp60',
FILENAME=N'D:\自动化测试数据库\流程平台\接口自动化库\kz\autotest_interface_BPM_ERP35_KZ.mdf') AS SNAPSHOT OF autotest_interface_BPM_ERP35;
PRINT 'autotest_interface_BPM_ERP35【创建】创建快照完成'


/* DECLARE @dbName NVARCHAR(max)='autotest_interface_BPM_app';
DECLARE @EXECSQL Nvarchar(1000) -- 要执行的动态SQL
DECLARE @actual_dbname Nvarchar(1000) -- 实际DB名
DECLARE @GETDBNAME Nvarchar(1000) -- 输出返回结果
SET @EXECSQL='select @actual_dbname =(select name from '+@dbName+'.sys.database_files where type=0)'
exec sp_executesql @EXECSQL,N'@actual_dbname Nvarchar(max) output', @GETDBNAME OUTPUT
print @GETDBNAME
 */


--查询数据库原实例名，及库存放地址，快照FILENAME和库地址放一起加后缀_KZ
--select * from huafudichan_352SP3_Upgrade.sys.database_files where type=0


